From 4799896879490f79cdf258e1184db540bdeeb451 Mon Sep 17 00:00:00 2001 From: oliskoli Date: Fri, 25 Apr 2008 18:37:27 +0000 Subject: [PATCH] exif: Add support for GPSTimeStamp. Generate reference data. --- exif.c | 18 +++++++++++++----- reference/IMG_2065.JPG | Bin 18399 -> 18399 bytes reference/exif-dat.csv | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/exif.c b/exif.c index 3b386a59d..f0599b4c5 100644 --- a/exif.c +++ b/exif.c @@ -29,6 +29,8 @@ #define MYNAME "exif" +#define UNKNOWN_TIMESTAMP 999999999 + typedef struct exif_tag_s { gbuint16 tag; gbuint16 type; @@ -388,7 +390,7 @@ exif_read(void) if (! next_ifd) continue; /* No IFD0 ? */ ifd = gps_ifd = exif_ifd = 0; - timestamp = (SECONDS_PER_DAY * 99); + timestamp = UNKNOWN_TIMESTAMP; /* we need the wpt not only during GPS IFD */ wpt = waypt_new(); @@ -415,11 +417,15 @@ exif_read(void) if (! wpt) return; -#if 0 - if (timestamp != (SECONDS_PER_DAY * 99)) { - // wpt->creation_time = timestamp; + if (wpt->creation_time && (timestamp != UNKNOWN_TIMESTAMP)) { + struct tm tm; + tm = *gmtime(&wpt->creation_time); + tm.tm_hour = 0; + tm.tm_min = 0; + tm.tm_sec = 0; + wpt->creation_time = mkgmtime(&tm) + timestamp; } -#endif + if (opt_filename) { char *c, *cx; char *str = xstrdup(fin->name); @@ -435,6 +441,7 @@ exif_read(void) xfree(str); } waypt_add(wpt); + return; } } @@ -479,4 +486,5 @@ ff_vecs_t exif_vecs = { exif_args, CET_CHARSET_ASCII, 0 }; + /**************************************************************************/ diff --git a/reference/IMG_2065.JPG b/reference/IMG_2065.JPG index 82da7182a672664e193c3543d63e453c60a9cfdf..0578f1f13c68fb07276eba72e294c49f64c49c5c 100644 GIT binary patch delta 41 xcmccL&v?I|al$=DqmB3HGKv~mnV4Cbnll&~7?@cZm|7VbDi|7Vp2+0q3IHNvGKyMSnV4Cbnll&~7?@cZm|7VbDi~UBp2+0q3IH^?4730M diff --git a/reference/exif-dat.csv b/reference/exif-dat.csv index 6d8c93998..47edcdbbe 100644 --- a/reference/exif-dat.csv +++ b/reference/exif-dat.csv @@ -1,2 +1,2 @@ No,Latitude,Longitude,Name,Speed,Satellites,Date,Time -1,44.315150,15.265690,"IMG_2065",0.0,4,2006/05/21,17:46:57 +1,44.315150,15.265690,"IMG_2065",0.0,4,2006/05/21,20:46:58 -- 2.30.2